package com.littcore.saap.assistant.service.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import com.littcore.dao.page.IPageList;
import com.littcore.dao.ql.PageParam;
import com.littcore.saap.assistant.dao.UserFavouriteDao;
import com.littcore.saap.assistant.service.IUserFavouriteService;
import com.littcore.saap.assistant.webservice.IUserFavouriteWebService;


public class UserFavouriteServiceImpl implements IUserFavouriteService,IUserFavouriteWebService {
	@Resource
	private UserFavouriteDao favouriteDao;
	
	public IPageList listPage(PageParam pageParam) {
		String listHql = "select obj from UserFavourite obj" +
				"-- and obj.tenantId={tenantId}" + 
				"-- and obj.moduleCode={moduleCode}" + 
			    "-- and obj.recordId={recordId}" +
				"-- and obj.createBy={createBy}";
		if(!StringUtils.isEmpty(pageParam.getCond("recordIds"))){
			listHql+="or obj.recordId in ("+pageParam.getCond("recordIds")+")";
		}
        
		return favouriteDao.listPage(listHql, pageParam);
	}


}
